<template>
  <a-card :bordered="false" class="card-area">

    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
      </a-table>
    </div>

  </a-card>
</template>

<script>
import { httpAction, putAction, getAction, postAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  name: 'FamilyInfoForm',
  mixins: [JeecgListMixin],
  components: {},
  props: {
     patientId: Number,
  },
  watch: {
    patientId(newValue) {
      this.getPatient(newValue);
    }
  },
  data() {
    return {
      queryParam: {
        inhospitalId: 0
      },
      confirmLoading: false,
      disableMixinCreated: true,
      validatorRules: {},
      // 表头
      columns: [
        {
          title: '异常编号',
          align: 'center',
          dataIndex: 'keyCode',
          width: 160
        },
        {
          title: '异常指标',
          align: 'center',
          dataIndex: 'keyName',
          width: 130
        },
        {
          title: '数据值',
          align: 'left',
          width: 500,
          dataIndex: 'itemList',
          customRender: function (text, record, index) {
            let textStr = '';
            console.log(record.itemList)
            record.itemList.forEach((item, index)=>{
              textStr+=item.indexName+"："+item.dataValue+ '\n'
            });

            const answer = textStr.split('\n')
            return answer.map((item) => {
              return <li>{item}</li>
            })
          },
        },
        {
          title: '参考值',
          align: 'center',
          dataIndex: 'normalValue',
          width: 120
        },
        {
          title: '结论',
          align: 'center',
          dataIndex: 'l',
          width: 120
        },
        {
          title: '是否己处理 ',
          align: 'center',
          dataIndex: 'w',
          width: 120
        },
        {
          title: '处理人员',
          align: 'center',
          dataIndex: 'c',
          width: 120
        },
        {
          title: '处理结果',
          align: 'center',
          dataIndex: 'd',
          width: 120
        },
      ],
      url: {
        list: '/his/patient/healthy/data/exception/list',
      }
    }
  },
  created() {
  },
  methods: {
    getPatient(patientId){
      this.queryParam.patientId = patientId
      this.loadData()
    },
  }
}
</script>

<style scoped>

</style>